package calculator.ast;

import javapop.framework.parser.expr.ExprAssoc;
import javapop.framework.parser.expr.ExprNode;
import javapop.framework.parser.expr.InfixNode;

public abstract class InfixOp extends Expr implements InfixNode {
	private ExprNode left;
	private ExprNode right;
	private int prio;
	private ExprAssoc assoc;
	
	protected InfixOp() {
		prio = -1;
		assoc = ExprAssoc.NO;
		left = null;
		right = null;
	}
	
	@Override
	public Expr getLeftOperand() {
		return (Expr) left;
	}

	@Override
	public void setLeftOperand(ExprNode left) {
		this.left = left;
	}

	@Override
	public Expr getRightOperand() {
		return (Expr) right;
	}

	@Override
	public void setRightOperand(ExprNode right) {
		this.right = right;
	}

	@Override
	public int getPrio() {
		return prio;
	}

	@Override
	public void setPrio(int prio) {
		this.prio = prio;
	}
	
	@Override
	public ExprAssoc getAssoc() {
		return assoc;
	}
	
	@Override
	public void setAssoc(ExprAssoc assoc) {
		this.assoc = assoc;
	}
	
	@Override
	public boolean isInfix() {		
		return true;
	}
}
